<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>考试成绩</title>
  <meta name="description" content="考试成绩">
  <meta name="keywords" content="index">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="renderer" content="webkit">
  
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="assets/css/admin.css">
  <script src="assets/js/jquery.min.js"></script> 
  <script src="assets/js/amazeui.min.js"></script>
  <script src="assets/js/app.js"></script>
  
  <style type="text/css">
  	/*注册弹出框样式*/
     .black_overlay { 
            display: none; 
            position: absolute;  
            top: 0%; 
            left: 0%; 
            width: 100%; 
            height: 100%; 
            background-color: Black; 
            z-index:1001;             
            opacity:.80;         
      } 
     .white_content { 
            display: none; 
            position: absolute; 
            top: 5%; 
            left: 5%; 
            width: 90%; 
            height: 90%;
            z-index:1002; 
            overflow: auto; 
      } 
 </style>
  
<script type="text/javascript">
    $(function(){
        /*公共部分
         */
        $(".headerpage").load("Head.html"); 
        $(".navigation").load("Navigation.html");
        if(sessionStorage.getItem('user_token')==null) {
          window.location.href = "index.html";
        }
        });
</script>

<script type="text/javascript">
       window.totalPage; //总页数
       window.currentPage = 1;  //当前页码
       window.pageNumber = 1;  //当前页（给后端）
       $(function(){
         //首页
         $("#firstPage").click(function(){
           $(".currentPage").attr("value", 1);
           fenye(1);
         })
         //上一页
         $("#beforePage").click(function(){
           pageNumber = parseInt($(".currentPage").attr("value"));
           if (pageNumber > 1) {
             $(".currentPage").attr("value", pageNumber - 1);
             fenye(pageNumber-1);
           }
           else {
             $(".beforePage").attr("disabled", false)
           }

         })
         //下一页
         $("#nextPage").click(function(){
           pageNumber = parseInt($(".currentPage").attr("value"));
           if (pageNumber < totalPage) {
             $(".currentPage").attr("value", pageNumber + 1);
             fenye(pageNumber+1);
           }
           else {
             $(".nextPage").attr("disabled", false)
           }

         })
         //尾页
         $("#lastPage").click(function(){

           $(".currentPage").attr("value", totalPage);
           pageNumber = parseInt($(".currentPage").attr("value"));
           fenye(pageNumber);
         })


         var tdata={
           "pageNumber": pageNumber
         }
		 $.ajax({
		  	type:"post",
		  	url:"/examin/select",
		  	beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
                },
		  	data:JSON.stringify(tdata),
            contentType:"application/json;charset=utf-8",
		  	success: function(data){
		        //方法中传入的参数data为后台获取的数据
                totalPage = data.pages;
                $(".totalPage").attr("value",totalPage);
		        for(i in data.data) //data.data指的是数组，数组里是8个对象，i为数组的索引
		        {
		            var tr;
		           tr='<td>'+data.data[i].name+'</td>'+/*'<td>'+data.data[i].id+'</td>'+*/
	                '<td>'+data.data[i].sub01+'</td>'+'<td>'+data.data[i].subMeg01+'</td>'+
	                '<td>'+data.data[i].sub02+'</td>'+'<td>'+data.data[i].subMeg02+'</td>'+
	                '<td>'+data.data[i].sub03+'</td>'+'<td>'+data.data[i].subMeg03+'</td>'+
	                '<td>'+data.data[i].sub04+'</td>'+'<td>'+data.data[i].subMeg04+'</td>'+   
	                '<td>'+'<button class="am-btn am-btn-default am-btn-xs am-text-danger" onclick="DeleteById('+data.data[i].id+')"><span class="am-icon-trash-o"></span>删除</button>'+'</td>';
	                 tr=tr.replace(/null/g,"");   
	                 $("#tablejd").append('<tr>'+tr+'</tr>');
		        }
		        
		        
		     }		  	
		 });

   });
</script>


<script>
	
	function DeleteById(id){
		if(window.confirm("确定要删除吗？")){
			 
    	 var tdata = {
    	 	  "id" : id, 	 
    	 }
       $.ajax({
				type:"post",
				url:"/examin/deleteById",
				data: JSON.stringify(tdata),
				contentType:"application/json;charset=utf-8",
				beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
                },
				success: function(data){
			        //方法中传入的参数data为后台获取的数据
			      if(data.code == "SQCG"){
			      	alert("删除成功！");
			      	window.location.href="subexamin.html";
			      }else{
			      	alert("删除失败！")
			      }
			                      
			   }	
			})
    }   
    else
    {
       
    }
	}
	
</script>

  <!-- 自定义函数 你好奥巴马 -->
  <script type="text/javascript">
    function fenye(pageNumber){
      var tdata={
        "pageNumber": pageNumber
      }
      $.ajax({
        type:"post",
        url:"/examin/select",
        beforeSend: function (XMLHttpRequest) {
          XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
        },
        data:JSON.stringify(tdata),
        contentType:"application/json;charset=utf-8",
        success: function(data){
          //方法中传入的参数data为后台获取的数据
          $("#tablejd  tr:not(:first)").empty("");
          for(i in data.data) //data.data指的是数组，数组里是8个对象，i为数组的索引
          {
            var tr;
            tr='<td>'+data.data[i].name+'</td>'+/*'<td>'+data.data[i].id+'</td>'+*/
                    '<td>'+data.data[i].sub01+'</td>'+'<td>'+data.data[i].subMeg01+'</td>'+
                    '<td>'+data.data[i].sub02+'</td>'+'<td>'+data.data[i].subMeg02+'</td>'+
                    '<td>'+data.data[i].sub03+'</td>'+'<td>'+data.data[i].subMeg03+'</td>'+
                    '<td>'+data.data[i].sub04+'</td>'+'<td>'+data.data[i].subMeg04+'</td>'+
                    '<td>'+'<button class="am-btn am-btn-default am-btn-xs am-text-danger" onclick="DeleteById('+data.data[i].id+')"><span class="am-icon-trash-o"></span>删除</button>'+'</td>';
            tr=tr.replace(/null/g,"");
            $("#tablejd").append('<tr>'+tr+'</tr>');
          }


        }
      });
    }
  </script>


<script type="text/javascript">
	/**
   * 搜索框查询
   */
	$(function(){
		$("#chazhao").click(function(){
			
		    
			var tdata={ 
				"name":$("#xingming").val(),
				"identity":$("#shenfen").val()
			}
			$.ajax({
				type:"post",
				url:"/examin/selectInput",
				data:JSON.stringify(tdata),
				contentType:"application/json;charset=utf-8",
				beforeSend: function (XMLHttpRequest) {
                    XMLHttpRequest.setRequestHeader("token", sessionStorage.getItem('user_token'));
                },
				success: function(data){
					   if(data.code == "MYSXTJ"){
					   	alert(data.msg);
					   }else{
					   	 document.getElementById('black').style.display='block';
			             document.getElementById('light').style.display='block';
                         $("#tabletest  tr:not(:first)").empty("");
					   	 //方法中传入的参数data为后台获取的数据
			         for(i in data.data) //data.data指的是数组，数组里是8个对象，i为数组的索引
			          {
			             var tr;
			            tr='<td>'+data.data[i].name+'</td>'+
		                '<td>'+data.data[i].sub01+'</td>'+'<td>'+data.data[i].subMeg01+'</td>'+'<td>'+data.data[i].sub02+'</td>'+'<td>'+data.data[i].subMeg02+'</td>'+
		                '<td>'+data.data[i].sub03+'</td>'+'<td>'+data.data[i].subMeg03+'</td>'+'<td>'+data.data[i].sub04+'</td>'+'<td>'+data.data[i].subMeg04+'</td>'+
		                '<td>'+'<button class="am-btn am-btn-default am-btn-xs am-text-danger" onclick="DeleteById('+data.data[i].id+')"><span class="am-icon-trash-o"></span>删除</button>'+'</td>';
		                 tr=tr.replace(/null/g,"");  		  
		                 $("#tabletest").append('<tr>'+tr+'</tr>');
			          }          
					   }
			       
			                      
			   }	
			})		
		})
		
		$("#fanhui").click(function(){
			 document.getElementById('black').style.display='none';
			 document.getElementById('light').style.display='none';
       //window.location.href="subexamin.html";
		})
		
	})
	
</script>


 
</head>


<body>
<header class="headerpage"></header>

<div class="am-cf admin-main"> 
  <!--菜单栏-->
  <div class="navigation"></div>




  <div class="admin-content">

    <div class="am-cf am-padding">
      <div class="am-fl am-cf"><!--<strong class="am-text-primary am-text-lg">首页</strong>-->
      	<strong class="am-text-primary am-text-lg">考试成绩</strong> / <small>信息</small>
   &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
  &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
      </div> 
      
      
      <div class="am-u-md-3 am-cf">
        <div class="am-fr">
          <div class="am-input-group am-input-group-sm">
            <input  type="text" class="am-form-field" id="xingming" placeholder="请输入姓名"/>
          </div>
        </div>
      </div>
      <div class="am-u-md-3 am-cf">
        <div class="am-fr">
          <div class="am-input-group am-input-group-sm">
      	    <input  type="text" class="am-form-field" id="shenfen" placeholder="请输入身份证号"/>
                <span class="am-input-group-btn">
                  <button class="am-btn am-btn-default" id="chazhao" type="button">搜索</button>
                </span>
          </div>
        </div>
      </div>
      
      
    </div> 
   
   
   
   
   
   
    <div id="fade" class="am-g">
      <div class="am-u-sm-12">
      
        <table id="tablejd" class="am-table am-table-bd am-table-striped admin-content-table">
          <thead>
          <tr>
            <th>姓名</th><th>科一</th><th>评价</th>
            <th>科二</th><th>评价</th><th>科三</th><th>评价</th>
            <th>科四</th><th>评价</th><th>操作</th>
          </tr>
          </thead>
         
        </table>
      
      </div>
    </div>

    <div class="paging" style="float:right; margin-right:80px;">
      <table>
        <tr class="page-font">
          <td width=""><a style="cursor: pointer"  width="24px" height="25px" id="firstPage" οnclick="page_click(this)" />首页</a></td>
          <td>&nbsp;<a style="cursor: pointer" width="27px" height="22px" id="beforePage" οnclick="page_click(this)" />上一页</a></td>
          <td>&nbsp;第<input style="width:40px;height:20px" type="text"  class="currentPage" value="1" readonly="readonly">页</td>
          <td>&nbsp;共<input style="width:40px;height:20px" type="text" class="totalPage" value="1" readonly="readonly">页</td>
          <td>&nbsp;<a style="cursor: pointer"  width="27px" height="26px" id="nextPage" οnclick="page_click(this)" />下一页</a></td>
          <td>&nbsp;<a style="cursor: pointer"  width="27px" height="24px" id="lastPage" οnclick="page_click(this)" />尾页</a></td>
        </tr>
      </table>
    </div>

    
</div>
</div>

<!--注册弹出框-->
<div id="light" class="white_content">
		
  <!-- content start -->
  <div class="admin-content">

    <div class="am-cf am-padding">
      <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">考试</strong> / <small>信息</small></div>
    </div>

    <div class="am-g">
      <div class="am-u-sm-12">
        
          <table id="tabletest"  class="am-table am-table-striped am-table-hover table-main">
            <thead>
              <tr>
            <th>姓名</th><th>科一</th>
            <th>评定</th><th>科二</th><th>评定</th><th>科三</th><th>评定</th>
            <th>科四</th> <th>评定</th><th>操作</th>
          </tr>
          </thead>
        </table>
        <button id="fanhui" class="am-btn am-btn-default am-btn-xs am-text-secondary">返回</button>
       
      </div>
    </div>
    
  </div>
  <!-- content end -->
     
</div>

<div id="black" class="black_overlay"></div>

</body>
</html>
